<template>
	<div>
		<uni-popup ref="popup" type="bottom">
			<view class="evaluate-order">
				<view class="remark-card">
					<view class="remark-card-title" >打招呼</view>
					<view class="remark-container">
						<textarea maxlength="100" v-model="form.content" placeholder="嗨,交个朋友吧～" class="remark"></textarea>
					</view>
				</view>
				<view class="btn-popup flexr justify-around">
					<view class="btn-close" @click="cancelPopup">算了</view>
					<view class="btn-comfire bottom-change-view" @click="submitRefund">确认打招呼({{integral}}积分)</view>
				</view>
			</view>
		</uni-popup>
	</div>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup'
import {sendMsg} from "@/constant/friend.js"
	import {errorToShow} from "@/config/common.js"
import saPopup from '@/components/sa-popup.vue';

	export default {
		name: 'homeHot',
		props: {
			integral: {
				type: [String,Number],
				default: ''
			},
			// sendMsgType: {
			// 	type: [String,Number],
			// 	default: ''
			// },
		},
		components:{
			uniPopup
		},
		data() {
			return {
				isShowRefundModal:false,
				txt_reason:'',
				form:{
					sendMsgType:1,//发送消息类型 1：普通消息 2：打招呼
					type:1,//消息类型 1：文本 2：图片 3：视频 4：语言
					receiverId:'',//接收人
					senderId:'',//发送人
					content:'',
					receiverNikeName:'',
					receiverHeadimgurl:'',
					senderNikeName:'',
					senderHeadimgurl:''
				}
			};
		},
		methods: {
			openPopup(receiverId,sendMsgType){
				this.form.receiverId=receiverId
				this.form.sendMsgType=sendMsgType
				this.$refs.popup.open()
			},
			cancelPopup(){
				this.$refs.popup.close()
			},
			submitRefund(){
				this.cancelPopup()
				sendMsg(this.form).then((res)=>{
					if(res.code!==0)
					errorToShow(res.masg)
					this.$emit('change')
				})
			}
			
		}
	};
</script>

<style lang="scss" scoped>
	.evaluate-order {
		padding: 20rpx;
		// background: linear-gradient(235deg, #FFD6BC , #FFEFE7 );
			background: linear-gradient(235deg, #fde8db , #fff8f4 );
		border-radius: 30rpx 30rpx 0 0;
		.remark-container {
			// border: 2rpx solid #f5f6fd;
			margin-top: 14rpx;
			background-color: #fff;
			padding:16rpx;
			border-radius: 10rpx ;
		}
	
		.remark {
			margin-left: 14rpx;
			margin-top: 14rpx;
			height: 180rpx;
			width: 90%;
			font-size: 28rpx;
		}
	}
	
	.remark-card {
		padding: 10rpx 20rpx;
		.remark-card-title {
			font-size: 32rpx;
			color: #333333;
			font-weight: 600;
			margin-bottom: 30rpx;
			text-align: center;
		}
	}
	.btn-popup{
		padding:30rpx 0 ;
		.btn-close{
			border:1px solid #999;
			padding:0 20rpx;
			line-height: 78rpx;
			font-size:28rpx;
			width: 30%;
			border-radius: 100rpx;
			color: #999;
			text-align: center;
		}
		.btn-comfire{
			width: 50%;
			color: #fff;
			padding:0 20rpx;
			line-height: 78rpx;
			font-size:28rpx;
			border-radius: 100rpx;
			text-align: center;
		}
	}
</style>